#include "FilterDialog.h"
#include "ui_FilterDialog.h"

FilterDialog::FilterDialog(const QStringList& filters, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FilterDialog)
{
    ui->setupUi(this);

    model = new QStringListModel(filters, this);
    ui->listView->setModel(model);

    connect(ui->listView, SIGNAL(clicked(QModelIndex)), this, SLOT(onListViewClick(QModelIndex)));

    ui->buttonAdd->setIcon(QIcon(":/images/add.png"));
    connect(ui->buttonAdd, SIGNAL(clicked()), this, SLOT(onButtonAddClick()));

    ui->buttonEdit->setIcon(QIcon(":/images/edit.png"));
    connect(ui->buttonEdit, SIGNAL(clicked()), this, SLOT(onButtonEditClick()));

    ui->buttonRemove->setIcon(QIcon(":/images/delete.png"));
    connect(ui->buttonRemove, SIGNAL(clicked()), this, SLOT(onButtonDeleteClick()));
}

FilterDialog::~FilterDialog()
{
    delete ui;
}

void FilterDialog::onButtonAddClick()
{

}

void FilterDialog::onButtonEditClick()
{

}

void FilterDialog::onButtonDeleteClick()
{

}

void FilterDialog::onListViewClick(QModelIndex index)
{
    ui->buttonEdit->setEnabled(index.isValid());
    ui->buttonRemove->setEnabled(index.isValid());
}
